package com.example.robertluozizhao.framecollectdemo.activity;

import android.os.Bundle;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
import androidx.appcompat.app.AppCompatActivity;
import android.widget.Button;

import com.example.robertluozizhao.framecollectdemo.R;
import com.example.robertluozizhao.framecollectdemo.fragment.AnimationTestFragment01;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Created by Lzz on 8/9/2019.
 */

public class FragmentEnterAnimationActivity extends AppCompatActivity {

    @BindView(R.id.btn_start_frgment)
    Button mBtnStartFrgment;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_fragment_enter_animation);
        ButterKnife.bind(this);
        initView();
    }

    private void initView() {

    }


    @Override
    protected void onDestroy() {
        super.onDestroy();
    }


    @OnClick(R.id.btn_start_frgment)
    public void onViewClicked() {
        FragmentManager supportFragmentManager = getSupportFragmentManager();
        FragmentTransaction transaction = supportFragmentManager.beginTransaction();
        Fragment fragment = new AnimationTestFragment01();
        transaction.setCustomAnimations(R.anim.anim_activity_enter,R.anim.anim_activity_out);
        transaction.add(R.id.viewGroup,fragment);
        transaction.addToBackStack(null);
        transaction.commitAllowingStateLoss();
    }
}
